﻿@model dPet.Web.Hospital.ViewModels.SaleOrderBillModel

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>dPet</title>
	<style type="text/css">
		* {
			padding: 0;
			margin: 0;
			font-family: '宋体';
		}

		.title {
			font-size: 17px;
			font-weight: normal;
			letter-spacing: -3pt;
			line-height: 20px;
			font-family: "方正姚体";
		}

		.text-left {
			text-align: left;
		}

		.text-right {
			text-align: right;
		}

		.salebill {
			margin: 0 auto;
			width: 190px;
			text-align: center;
			line-height: 20px;
		}

			.salebill .address {
				font-size: 13px;
			}

			.salebill .contact {
				font-size: 15px;
				font-weight: bold;
			}

			.salebill .datetime {
				font-size: 13px;
				letter-spacing: -1px;
			}

			.salebill .order-list {
				width: 100%;
				font-size: 14px;
			}

				.salebill .order-list .header-top th {
					border-bottom: 1px dashed #666;
					padding-bottom: 3px;
					font-weight: normal;
				}

				.salebill .order-list .footer-top td {
					border-top: 1px dashed #000;
					padding-top: 3px;
				}

			.salebill .total {
				font-size: 15px;
				font-weight: bold;
				letter-spacing: 3pt;
			}

		.print-panel {
			text-align: center;
			margin: 40px auto;
		}

			.print-panel button {
				padding: 5px 10px;
			}
	</style>
</head>

<body>
	<div class="salebill">
		<div class="title">@Model.Template.BillTitle</div>

		@if (Model.Template.ShowAddress)
		{ 
			<div class="address">地址:@Model.Template.Address</div>
		}
		
		@if (Model.Template.ShowPhoneNumber)
		{
			<div class="contact">电话:@Model.Template.PhoneNumber</div>
		}
		
		@if (Model.Template.ShowFaxNumber)
		{
			<div class="contact">传真:@Model.Template.FaxNumber</div>
		}
		
		<div class="datetime">时间:@Model.SaleOrder.CompleteTime.ToString("yyyy-MM-dd HH:mm:ss")</div>

		<br />

		<table class="order-list" cellpadding="0">
			<thead>
				<tr class="header-top">
					<th>品名</th>
					<th width="22%">数量</th>
					<th width="22%">单价</th>
					<th width="22%">金额</th>
				</tr>
			</thead>
			<tbody>
				@foreach (var orderLine in Model.SaleOrder.OrderLines)
				{
					<tr>
						<td class="text-left">@orderLine.ProductName</td>
						<td>@orderLine.Quantity</td>
						<td>@orderLine.UnitPrice</td>
						<td class="text-right">@(orderLine.UnitPrice * orderLine.Quantity)</td>
					</tr>
				}
			</tbody>
			<tfoot>
				<tr class="footer-top">
					<td class="text-left" colspan="3">合计:</td>
					<td class="text-right">@Model.SaleOrder.TotalAmount</td>
				</tr>
			</tfoot>
		</table>

		<br />

		<div class="title">@Model.Template.FootText</div>
	</div>

	<div class="print-panel">
		<button id="btn_print">打 印</button>
	</div>

	<script src="http://resource.dfancy.cn/common/js/jquery-2.1.1.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$("#btn_print").bind("click", function () {
			$("#btn_print").hide();

			print();

			$("#btn_print").show();
		});
	</script>
</body>
</html>
